package com.fancy.applicaiton.tools.htmltox.service.impl;


import com.fancy.applicaiton.tools.htmltox.service.IFancyToolsHtml2PdfService;
import com.fancy.applicaiton.tools.htmltox.wrapper.htmltopdf.Pdf;
import com.fancy.applicaiton.tools.htmltox.wrapper.htmltopdf.source.ContentSource;
import com.fancy.applicaiton.tools.htmltox.wrapper.htmltopdf.source.UrlSource;


import org.springframework.stereotype.Service;



@Service
public class FancyToolsHtml2PdfService implements IFancyToolsHtml2PdfService {
    @Override
    public String getPdf(String fdUrl) {
        Pdf pdf = new Pdf();
        pdf.addSource(new UrlSource(fdUrl));
        String path = pdf.save();
        return path;
    }

    /**
     * 根据内容生成pdf
     * @param fdContent
     * @return
     */
    @Override
    public String getPdfContent(String fdContent) {
        Pdf pdf = new Pdf();
        pdf.addSource(new ContentSource(fdContent));
        String path = pdf.save();
        return path;
    }


}
